package org.hyl.javabase.model;

public class proxyDemo {
	  public static void main(String[] args) {  
		  proxySourceable source = new Proxy();  
	        source.method();  
	    }  
}
interface proxySourceable {  
    public void method();  
}  
class proxySource implements proxySourceable {  
    public void method() {  
        System.out.println("the original method!");  
    }  
} 

class Proxy implements proxySourceable {  
	  
    private proxySource source;  
    public Proxy(){  
        super();  
        this.source = new proxySource();  
    }  
    public void method() {  
        before();  
        source.method();  
        atfer();  
    }  
    private void atfer() {  
        System.out.println("after proxy!");  
    }  
    private void before() {  
        System.out.println("before proxy!");  
    }  
}  